//Control to display all speciality
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class includes_allspeciality_dentist : System.Web.UI.UserControl
{
    SiteManager.Manager manager = new SiteManager.Manager();
    protected void Page_Load(object sender, EventArgs e)
    {
        Bind_gvSpeciality();
    }
    /// <summary>
    /// Function to display list of specialities in the left panel
    /// </summary>
    private void Bind_gvSpeciality()
    {
        string strQuery = string.Empty;
        // QUERY CHANGED AS THE SITE MAP ONLY SHOWS THE MAIN SPECIALTY NOT THE SUB SPECIALTY
        //strQuery = "select DIStinct cast(id as varchar)+ ',0' as id, specialty as name from tbl_DentistSpecialty union select '0,' + cast(id as varchar) as id,specialty as name from tbl_DentistSubSpecialty order by specialty";
        strQuery = "select DIStinct specialty as name from tbl_DentistSpecialty union select specialty as name from tbl_DentistSubSpecialty order by specialty";
        // strQuery = "select id, specialty as name from tbl_DentistSpecialty";
        
        DataSet dsLink = new DataSet();
        dsLink = manager.ExecuteQuery(strQuery, "tblSpeciality");
        if (dsLink.Tables["tblSpeciality"].Rows.Count > 0)
        {
            lblMsg.Visible = false;
            gvSpeciality.Visible = true;
            gvSpeciality.DataSource = dsLink;
            gvSpeciality.DataBind();
        }
        else
        {
            gvSpeciality.Visible = false;
            lblMsg.Visible = true;
            lblMsg.Text = "<font color=red><b>No Records found !!!</b></font>";
        }
    }
    protected string getUrl(object st) // Changed on July 27,2007 by ad 
    {
        return st.ToString().Replace(" & ", " and ").Replace(" ", "_").ToLower().Replace(",", "-or-");
    }
}
